<template>
  {{ count }}
  <AppHeader />
  <button @click="increment">+</button>
</template>

<script setup>
import {useStore} from 'vuex'
import {computed} from 'vue'
import AppHeader from './components/AppHeader.vue'
const store = useStore() //hooks 编程
console.log(store.state.count);
const count = computed(()=>store.state.count)

const increment = ()=>{
  // 也可以使用 commit 代替 dispatch
  // 派出一个 increment action 
  store.dispatch('increment')
}

</script>

<style lang="css" scoped>

</style>